package com.houhanzhi.job;

import com.houhanzhi.service.TrafficService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class TrafficJobHandler {

    @Autowired
    private TrafficService trafficService;

    @XxlJob(value = "trafficExpireJobHandler",init = "init",destroy = "destroy")
    public ReturnT<String> execute(String param){

        log.info("流量包过期任务方法触发成功");
        trafficService.deleteExpiredTraffic();
        return ReturnT.SUCCESS;
    }

    private void init(){


        log.info("流量包过期 init >>>>>");
    }

    private void destroy(){
        log.info("流量包过期 destroy >>>>>");
    }

}
